package com.hospital.service.sample.service.impl;

import com.graphbuilder.curve.CubicBSpline;
import com.hospital.service.project.service.ProInfoBaseService;
import com.hospital.service.publics.service.PubFilePathService;
import com.hospital.service.sample.model.param.SamInfoExportParam;
import common.core.constant.Constant;
import common.core.entity.SamInfoExportEntity;
import common.core.util.CommonUtil;
import common.core.util.CustomizeRuntimeException;
import enhance.plus.logic.LogicBaseServiceImpl;
import com.hospital.service.sample.entity.SamInfoDetails;
import com.hospital.service.sample.mapper.SamInfoDetailsMapper;
import com.hospital.service.sample.service.SamInfoDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;

/**
* 实验样本详细表 接口
*
* @author lfb
* @created 2020-10-10 14:27:13
*/
@SuppressWarnings("all")
@Service
public class SamInfoDetailsServiceImpl extends LogicBaseServiceImpl<SamInfoDetailsMapper, SamInfoDetails> implements SamInfoDetailsService{

    @Autowired
    private SamInfoDetailsMapper samInfoDetailsMapper;

    @Autowired
    private PubFilePathService pubFilePathService;


    @Autowired
    private ProInfoBaseService proInfoBaseService;

    @Override
    public String getSamplesDetailsNumber() {
        return proInfoBaseService.getCode("sam_info_details",Constant.SPECIFIC_SAMPLES_PREFIX,"organization_number");
    }

    /**
     * 增加样本详情信息
     * @param copyBean
     */
    @Transactional
    @Override
    public void add(SamInfoDetails copyBean) {
        this.save(copyBean);
        pubFilePathService.fileCreate(copyBean.getOrganizationNumber(),copyBean.getSamplesNumber());
    }

    @Override
    public void projectExport(SamInfoExportParam param, HttpServletResponse response) {
        if (CommonUtil.isEmpty(param)) {
            throw CustomizeRuntimeException.exception("传入的参数为空");
        }

    }
}
